<include file="../Public/admintop" />
<include file="../Public/adminleft" />
<script type="text/javascript">
	function ajaxFileUpload()
	{
		$("#loading")
		.ajaxStart(function(){
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});

		$.ajaxFileUpload
		(
			{
				url:"{:U('Brand/upload')}",
				secureuri:false,
				fileElementId:'fileToUpload',
				dataType: 'json',
				success: function (data, status)
				{
					
					if (status==1){
						$("#msg").text(data.info);
					}
					else{
						$("#msg").text(data.info);
						$('#imgurlbox').html("<img src=\"__ROOT__/"+data.data.savename+"\"/>");
						$("#imgurlbox").show();
						$("#imgurl").val(data.data.savename);
					}


				},
				error: function (data, status, e)
				{
					alert(e);
				}
			}
		)		
		return false;

	}
</script>
<!-- Content (Right Column) -->
		<div id="content" class="box">

			<h1>编辑品牌</h1>
            <p class="msg info">提示：<label id="msg"></label><span id="loading" style="display:none;"><img   src="../Public/images/loading.gif" style="height:20px;">上传中...</span>	</p>
            
            <p id="btn-create" class="box">
              <a href="{:U('Brand/brandlist')}">品牌列表</a>
            </p>
            <form action="{:U('Brand/Update')}" name="myform" method="post" enctype="multipart/form-data">
            <table class="nostyle">
                    <tr>
						<td style="width:120px;">名称:</td>
						<td><input type="text" size="40" name="name" class="input-text" value="{$list['name']}" /></td>
					</tr>
                    <tr>
						<td style="width:120px;">LOGO:</td>
						<td><input type="file" size="20" id="fileToUpload" name="fileToUpload" class="input-text"  /><input class="input-submit" id="upload"  type="button" name="upload" value="上传" onClick="return ajaxFileUpload();" /><input type="hidden" name="imgurl" id="imgurl" value="{$list['imgurl']}" /><notempty name="list['imgurl']"><input type="button" onclick="window.location.href='{:U('Brand/setimg_empty',array('f'=>'imgurl','id'=>$list['id']))}';" value="删除图片"/></notempty>
                        <br>
                        <span id="imgurlbox">
                         <notempty name="list['imgurl']">
                         <img src="__ROOT__/{$list['imgurl']}" />
                         </notempty>
                         </span>
                        </td>
					</tr>
                    <tr>
						<td style="width:120px;">排序:</td>
						<td><input type="text" size="10" name="sort" class="input-text" value="{$list['sort']}" /></td>
					</tr>
                    
                   
                    <tr>
						<td style="width:120px;">状态:</td>
						<td><input type="radio" value="1"  name="status" class="input-text" checked />是<input type="radio" value="0"  name="status" class="input-text"   />否</td>
					</tr>
                    <tr>
						<td style="width:120px;">标题:</td>
						<td><input type="text" size="60" name="title" class="input-text" value="{$list['title']}" /></td>
					</tr>
                    <tr>
						<td style="width:120px;">内容:</td>
						<td><textarea name="content" cols="60" rows="10" class="input-text">{$list['content']}</textarea></td>
					</tr>
                    <tr>
						<td style="width:120px;">关键字(SEO):</td>
						<td><textarea name="keywords" cols="60" rows="10" class="input-text">{$list['keywords']}</textarea></td>
					</tr>
                    <tr>
						<td style="width:120px;">描述(SEO):</td>
						<td><textarea name="description" cols="60" rows="10" class="input-text">{$list['description']}</textarea></td>
					</tr>
                    <tr>
						<td colspan="2" class="t-right"><input type="submit" class="input-submit" value="更新" />
                        </td>
					</tr>
            </table>
            <input type="hidden" name="id" value="{$list['id']}" />
            <script language="javascript" type="text/javascript">
			   $("input[name='status'][value={$list['status']}]").attr("checked",true);
			</script>
            </form>
		</div> <!-- /content -->
<include file="../Public/adminfooter" />